<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 比较两个日期是否相同 -->
</head>
<body>
  <script>
    var date1 = new Date("2020-06-06");
    var date2 = new Date("2020-06-06");
    console.log(date1.getTime() == date2.getTime()); //true
  </script>
</body>
</html>